<include file="public@head"/>
<block name="seo">
    <title>{$site_info.site_name|default=''}-文章</title>
    <meta name="keywords" content="{$site_info.site_seo_keywords|default=''}"/>
    <meta name="description" content="{$site_info.site_seo_description|default=''}">
</block>

<div class="doc-container" id="doc-container">
    <div class="container-fixed">
        <div class="col-content">
            <div class="inner">
                <article class="article-list bloglist" id="LAY_bloglist" >

                    <php>
                        $cid = input('cid', 0);
                        $keyword = input('key', '');
                        $where = function($query) use($keyword){
                            $query->where('post.post_status','=',1);
                            if(!empty($keyword)){
                                $query->where('post.post_title','like', '%'.$keyword.'%');
                                $query->whereOr('post.post_keywords','like', '%'.$keyword.'%');
                                $query->whereOr('post.post_excerpt','like', '%'.$keyword.'%');
                            }
                        };
                        $hot_where = function($query) use($keyword){
                            $query->where('post.post_status','=',1);
                        };
                        $page=[
                        'list_rows'=>5,
                        'next'=>'下一页',
                        'prev'=>'上一页'
                        ];
                    </php>
                    <portal:articles item="vo" where="$where" order="post.is_top DESC,post.id DESC" page="$page" categoryIds="$cid"
                                     returnVarName="articles_data">
                        <section class="article-item zoomIn article">
                            <if condition="$vo['is_top'] == 1">
                                <div class="fc-flag">置顶</div>
                            </if>
                            <h5 class="title">
                                <span class="fc-blue">【原创】</span>
                                <a href="{:cmf_url('portal/Article/index',array('id'=>$vo['id']))}">.{$vo.post_title}</a>
                            </h5>
                            <div class="time">
                                <span class="day">{:date('d', $vo.published_time)}</span>
                                <span class="month fs-18">{:date('m', $vo.published_time)}<span class="fs-14">月</span></span>
                                <span class="year fs-18 ml10">{:date('Y', $vo.published_time)}</span>
                            </div>
                            <div class="content">
                                <a href="{:cmf_url('portal/Article/index',array('id'=>$vo['id']))}" class="cover img-light">
                                    <img src="{:cmf_get_image_url($vo.thumbnail)}">
                                </a>
                                {$vo.post_excerpt}
                            </div>
                            <div class="read-more">
                                <a href="{:cmf_url('portal/Article/index',array('id'=>$vo['id']))}" class="fc-black f-fwb">继续阅读</a>
                            </div>
                            <aside class="f-oh footer">
                                <div class="f-fl tags">
                                    <span class="fa fa-tags fs-16">{$vo.post_keywords}</span>
                                    <a class="tag"></a>
                                </div>
                                <div class="f-fr">
									<span class="read">
										<i class="fa fa-eye fs-16"></i>
										<i class="num">{$vo.post_hits}</i>
									</span>
                                    <!--<span class="ml20">
										<i class="fa fa-comments fs-16"></i>
										<a href="javascript:void(0)" class="num fc-grey">1</a>
									</span>-->
                                </div>
                            </aside>
                        </section>

                    </portal:articles>

                </article>


            </div>
            <ul class="mt-30 pagination">
                <page/>
            </ul>
        </div>
        <div class="col-other">
            <div class="inner">
                <div class="other-item" id="categoryandsearch">
                    <div class="search">
                        <label class="search-wrap">
                            <input type="text" id="searchtxt" placeholder="输入关键字搜索" value="{$keyword}"/>
                            <span class="search-icon">
                                <i class="fa fa-search"></i>
                            </span>
                        </label>
                        <ul class="search-result"></ul>
                    </div>
                    <ul class="category mt20" id="category">
                        <li data-index="0" class="slider"></li>
                        <li data-index="1"><a href="{:cmf_url('/portal/list')}">全部文章</a></li>
                        <portal:categories item="cate">
                        <li data-index="{$cate['id']+1}"><a href="{:cmf_url('/portal/list',array('cid'=>$cate['id']))}">{$cate['name']}</a></li>
                        </portal:categories>
                    </ul>
                </div>
                <!--右边悬浮 平板或手机设备显示-->
                <div class="category-toggle"><i class="layui-icon">&#xe603;</i></div>
                <div class="article-category">
                    <div class="article-category-title">分类导航</div>
                    <portal:categories item="cate">
                        <li data-index="{$cate['id']}"><a href="{:cmf_url('/portal/list',array('cid'=>$cate['id']))}">{$cate['name']}</a></li>
                    </portal:categories>
                    <div class="f-cb"></div>
                </div>
                <!--遮罩-->
                <div class="blog-mask animated layui-hide"></div>
                <div class="other-item">
                    <h5 class="other-item-title">热门文章</h5>
                    <div class="inner">
                        <ul class="hot-list-article">
                            <portal:articles item="vos" where="$hot_where" order="post.post_hits DESC"
                                             field="post.id,post.post_hits,post.post_title" limit="6">
                            <li> <a href="{:cmf_url('portal/Article/index',array('id'=>$vos['id']))}">{$vos['post_title']}</a></li>
                            </portal:articles>
                        </ul>
                    </div>
                </div>
                <!--<div class="other-item">
                    <h5 class="other-item-title">置顶推荐</h5>
                    <div class="inner">
                        <ul class="hot-list-article">
                            <li> <a href="/Blog/Read/16">.NET Spire.Doc组件</a></li>
                            <li> <a href="/Blog/Read/14">MUI框架-快速开发APP</a></li>
                            <li> <a href="/Blog/Read/9">2018最新版QQ音乐api调用</a></li>
                        </ul>
                    </div>
                </div>-->
                <div class="other-item">
                    <h5 class="other-item-title">最近访客</h5>
                    <div class="inner">
                        <dl class="vistor">
                            <if condition="$nickname neq ''">
                                <dd>
                                    <a href="javasript:;">
                                        <img src="{$user['avatar']}">
                                        <cite>{$nickname}</cite>
                                    </a>
                                </dd>
                            <else />
                                <dd><a href="javasript:;"><img src="https://thirdqq.qlogo.cn/qqapp/101465933/72388EA977643E8F97111222675720B1/100"><cite>Anonymous</cite></a></dd>
                            </if>
                            <dd><a href="javasript:;"><img src="https://thirdqq.qlogo.cn/qqapp/101465933/342F777E313DDF5CCD6E3E707BB0770B/100"><cite>Dekstra</cite></a></dd>
                            <dd><a href="javasript:;"><img src="https://thirdqq.qlogo.cn/qqapp/101465933/EA5D00A72C0C43ECD8FC481BD274DEEC/100"><cite>惜i</cite></a></dd>
                            <dd><a href="javasript:;"><img src="https://thirdqq.qlogo.cn/qqapp/101465933/EF18CEC98150D2442183AA30F05AAD7B/100"><cite>↙Aㄨ计划 ◆莪↘</cite></a></dd>
                            <dd><a href="javasript:;"><img src="https://thirdqq.qlogo.cn/qqapp/101465933/3D8D91AD2BAFD36F5AC494DA51E270E6/100"><cite>.</cite></a></dd>
                            <dd><a href="javasript:;"><img src="https://thirdqq.qlogo.cn/qqapp/101465933/B745A110DAB712A0E6C5D0B633E905D3/100"><cite>Lambert.</cite></a></dd>
                            <dd><a href="javasript:;"><img src="https://thirdqq.qlogo.cn/qqapp/101465933/E9BA3A2499EC068B7917B9EF45C4D13C/100"><cite>64ღ</cite></a></dd>
                            <dd><a href="javasript:;"><img src="https://thirdqq.qlogo.cn/qqapp/101465933/09F92966169272DD7DD9999E709A0204/100"><cite>doBoor</cite></a></dd>
                            <dd><a href="javasript:;"><img src="https://thirdqq.qlogo.cn/qqapp/101465933/59991D53192643A1A651383847332EB6/100"><cite>毛毛小妖</cite></a></dd>
                            <dd><a href="javasript:;"><img src="https://thirdqq.qlogo.cn/qqapp/101465933/FF34F311DDC43E2AF63BE897BCA24F05/100"><cite>NULL</cite></a></dd>
                            <dd><a href="javasript:;"><img src="https://thirdqq.qlogo.cn/qqapp/101465933/59AA25A7627284AE62C8E6EBDC6FE417/100"><cite>吓一跳</cite></a></dd>
                            <dd><a href="javasript:;"><img src="https://thirdqq.qlogo.cn/qqapp/101465933/28B021E0F5AF0A4B9B781A24329FE897/100"><cite>如初</cite></a></dd>
                        </dl>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<include file="public@foot"/>
<block name="js">
    <script src="__TMPL__/public/assets/js/yss/article.js?v=4"></script>
    <script>
        $(document).ready(function() {
            // 监听回车键按下事件
            $('#searchtxt').on('keyup', function(e) {
                if (e.key === 'Enter') {
                    redirectToSearch(this.value);
                }
            });

            // 监听span的点击事件
            $('.search-icon').on('click', function() {
                var searchValue = $('#searchtxt').val();
                redirectToSearch(searchValue);
            });

            // 重定向函数
            function redirectToSearch(keyword) {
                if (keyword) {
                    window.location.href = '?key=' + encodeURIComponent(keyword);
                }
            }
        });
    </script>
</block>
